import request from '@/utils/request'

// 查询学生信息列表
export function listStudents(query) {
  return request({
    url: '/schoolmanage/students/list',
    method: 'get',
    params: query
  })
}

// 查询学生信息详细
export function getStudents(studentId) {
  return request({
    url: '/schoolmanage/students/' + studentId,
    method: 'get'
  })
}

// 新增学生信息
export function addStudents(data) {
  return request({
    url: '/schoolmanage/students',
    method: 'post',
    data: data
  })
}

// 修改学生信息
export function updateStudents(data) {
  return request({
    url: '/schoolmanage/students',
    method: 'put',
    data: data
  })
}

// 批量删除学生
export function batchDeleteStudents(studentIds) {
  return request({
    url: '/schoolmanage/students/batch/' + studentIds.join(','),
    method: 'delete'
  })
}

// 删除学生（支持强制删除）
export function deleteStudent(studentId, force = false) {
  return request({
    url: `/schoolmanage/students/${studentId}`,
    method: 'delete',
    params: { force } // 强制删除参数
  })
}

// 检查学生关联数据
export function checkStudentAssociations(studentId) {
  return request({
    url: `/schoolmanage/students/check-associations/${studentId}`,
    method: 'get',
    timeout: 5000
  })
}

// 导入学生信息
export function importStudents(data) {
  return request({
    url: '/schoolmanage/students/importData',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}
export function saveExamConfig(data) {
  return request({
    url: '/schoolmanage/students/studentExam',
    method: 'post',
    data: data
  })
}
//向后端那机房信息数据
export function getComputerRooms() {
  return request({
    url: '/schoolmanage/students/listjifang',
    method: 'get'
  })
}